<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.net.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ff" uri="/WEB-INF/firstframe.tld" %>
<%@ page import="cn.firstsoft.firstframe.util.ContextUtils,cn.firstsoft.firstframe.util.Version"%>
<fmt:message key="docexFile_favorbox_label21" var="docexFile_favorbox_label21"/>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control",
			"no-store, no-cache, must-revalidate");
	response.setHeader("Expires", "Sat, 1 Jan 2000 12:00:00 GMT");
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>助手首页</title>
<link href="client/css/style.css" rel="stylesheet" type="text/css" />
<script src="<c:url value="/scripts/prototype/prototype.js"/>" type="text/javascript"></script>
<script src="<c:url value="/scripts/prototype/scriptaculous.js"/>" type="text/javascript"></script>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
</style>
</head>
<c:set var="sessionid" value="${sessionid}" /> <%-- 用于产生单点登录链接(ff:ssolink) --%>
<body onLoad="MM_preloadImages('client/images/top_background_home2.png','client/images/top_background_db2.png','client/images/top_background_colleague2.png','client/images/top_background_dope2.png')" scroll="no" onContextMenu="return false">
<table width="100%">
  <tr>
    <td height="28" background="client/images/top_backdrop.gif" style="padding-left:11px;color:#000" >${displayName}</td>
  </tr>
</table>
<table width="100%" height="23">
  <tr>
  	<td width="5" background="client/images/top_background.png">&nbsp;</td>
    <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/home/portal.do" title="首页"><img src="client/images/top_background_home.png" name="Image1" width="32" height="23" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','client/images/top_background_home2.png',1)" onMouseOut="MM_swapImgRestore()" title="首页"></ff:ssolink></td>
    <%if(ContextUtils.isValidModule("workflow")){ %>
    <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/workflow/workflowFileinbox.do?method=list&ec_s_startdate=desc" title="协同审批"><img src="client/images/top_background_db.png" name="Image2" width="32" height="23" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','client/images/top_background_db2.png',1)" onMouseOut="MM_swapImgRestore()"></ff:ssolink></td>
    <%} %>
     <%if(ContextUtils.isValidModule("knowledge")){ %>
    <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/knowledge/knowledges.do?method=knowmap&cid=0" title="知识中心"><img src="client/images/top_background_zszx.png" name="Image3" width="32" height="23" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','client/images/top_background_zszx2.png',1)" onMouseOut="MM_swapImgRestore()"></ff:ssolink></td>
     <%} %>
   <%if(ContextUtils.isValidModule("docex")){ %>
    <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/docex/docexFile.do?method=inbox&ec_s_createdate=desc" title="协同工作"><img src="client/images/top_background_db.png" name="Image2" width="32" height="23" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','client/images/top_background_db2.png',1)" onMouseOut="MM_swapImgRestore()"></ff:ssolink></td>
      <%} %>
   <%if(ContextUtils.isValidModule("fileman")){ %>
    <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/fileman/fileman.do" title="文档管理"><img src="client/images/top_background_zszx.png" name="Image3" width="32" height="23" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','client/images/top_background_zszx2.png',1)" onMouseOut="MM_swapImgRestore()"></ff:ssolink></td>
    <%} %>
  
    <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/address/addressUser.do" title="通讯录"><img src="client/images/top_background_txl.png" name="Image4" width="32" height="23" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','client/images/top_background_txl2.png',1)" onMouseOut="MM_swapImgRestore()"></ff:ssolink></td>
 
    <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/message/messages.do?ec_s_createdate=desc" title="消息中心"><img src="client/images/top_background_dope.png" name="Image5" width="32" height="23" border="0" id="Image5" onMouseOver="MM_swapImage('Image5','','client/images/top_background_dope2.png',1)" onMouseOut="MM_swapImgRestore()"></ff:ssolink></td>
    <c:if test="${showSetting}">
        <td width="32"><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/setting/user.do?method=modifyInfo" title="个人设置"><img src="client/images/top_background_grsz.png" name="Image6" width="32" height="23" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','client/images/top_background_grsz2.png',1)" onMouseOut="MM_swapImgRestore()"></ff:ssolink></td>
    </c:if>	
    <td background="client/images/top_background.png">&nbsp;</td>
  </tr>
</table>
<div id="left">
	 <dl>	 	 	
		<dt>
			<table style="width:100%;height:21px" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="3"><img src="client/images/menuLeft.gif" width="3" height="21" id="img_menuleft"></td>
					<td width="14" align="right" style="background:url(client/images/menubg.gif); background-repeat:repeat-x;"><img src="client/images/ico_select.gif" width="12" height="12" id="img_ico"></td>
					<td style="background:url(client/images/menubg.gif); background-repeat:repeat-x; color:#000">&nbsp;最新消息&nbsp;<font color="#777777">(${fn:length(newMessages)})</font></td>
					<td width="3"><img src="client/images/menuright.gif" width="3" height="21" id="img_menuright"></td>
				</tr>
			</table>		
		</dt>
		<dd>
			<table width="100%" class="tbl_left_ico">
				<c:set var="messageCount" value="0" />
				<c:forEach var="m" items="${newMessages}">
				<c:set var="messageCount" value="${messageCount + 1}" />
				<tr>
					<td><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/message/messages.do?method=show&id=${m.id}">${m.title}</ff:ssolink>
					 <!-- add by liuzhengwei 2010-10-08 start 增加最新消息已阅功能 -->
					<a href="#" onclick="readMessage('${m.id}');"><img src="client/images/read.gif" width="16" height="16" alt="${docexFile_favorbox_label21}" border="0"></a>
					<!-- add by liuzhengwei 2010-10-08 end -->
					</td>
				</tr>
				</c:forEach>
				<c:if test="${messageCount eq 0}">
				<tr>
					<td>没有最新消息</td>
				</tr>					
				</c:if>	
		  </table>
		</dd>
	</dl>
  <%if(ContextUtils.isValidModule("workflow")){ %>
	<dl>
		<dt>
			<table style="width:100%;height:21px" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="3"><img src="client/images/menuLeft.gif" width="3" height="21" id="img_menuleft"></td>
					<td width="14" align="right" style="background:url(client/images/menubg.gif); background-repeat:repeat-x;"><img src="client/images/ico_select.gif" width="12" height="12" id="img_ico"></td>
					<td style="background:url(client/images/menubg.gif); background-repeat:repeat-x; color:#000">&nbsp;待办公文&nbsp;<font color="#777777">(${fn:length(workflowFileinboxs)})</font></td>
					<td width="3"><img src="client/images/menuright.gif" width="3" height="21" id="img_menuright"></td>
				</tr>
			</table>	
	  </dt>
		<dd >
			<table width="100%" class="tbl_left_ico">
				<c:set var="inboxCount" value="0" />
				<c:forEach items="${workflowFileinboxs}" var="workflowFileinbox">
				<c:set var="inboxCount" value="${inboxCount + 1}" />
				<tr>
					<td>
						<c:if test="${workflowFileinbox.issent == 2 || workflowFileinbox.issent == 4}">
						<ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/workflow/workflowFileinbox.do?method=edit&id=${workflowFileinbox.id}" title="${workflowFileinbox.workflowFile.title}">${workflowFileinbox.workflowFile.title}</ff:ssolink>
						</c:if>
						<c:if test="${workflowFileinbox.issent == 1}">
						<ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/workflow/workflowFileinbox.do?method=show&id=${workflowFileinbox.id}" title="${workflowFileinbox.workflowFile.title}">		        	
							<b>${workflowFileinbox.workflowFile.title}</b></ff:ssolink>&nbsp;<img src="client/images/new.gif" border="0" />
						</c:if>						
					</td>
				</tr>
				</c:forEach>
				<c:if test="${inboxCount eq 0}">				
				<tr>
					<td>没有待办公文</td>
				</tr>
				</c:if>
		  </table>
		</dd>
	</dl>
	<%} %>

	<!-- 通知消息 这里叫在线留言-->
		 <dl>	 	 	
		<dt>
			<table style="width:100%;height:21px" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="3"><img src="client/images/menuLeft.gif" width="3" height="21" id="img_menuleft"></td>
					<td width="14" align="right" style="background:url(client/images/menubg.gif); background-repeat:repeat-x;"><img src="client/images/ico_select.gif" width="12" height="12" id="img_ico"></td>
					<td style="background:url(client/images/menubg.gif); background-repeat:repeat-x; color:#000">&nbsp;在线留言&nbsp;<font color="#777777">(${fn:length(newMessages0)})</font></td>
					<td width="3"><img src="client/images/menuright.gif" width="3" height="21" id="img_menuright"></td>
				</tr>
			</table>		
		</dt>
		<dd>
			<table width="100%" class="tbl_left_ico">
				<c:set var="messageCount0" value="0" />
				<c:forEach var="m" items="${newMessages0}">
				<c:set var="messageCount0" value="${messageCount0 + 1}" />
				<tr>
					<td><ff:ssolink target="F1OAWINDOW" reqFrom="oa" nexturl="/modules/message/messages.do?method=show&id=${m.id}">${m.title}</ff:ssolink></td>
				</tr>
				</c:forEach>
				<c:if test="${messageCount0 eq 0}">
				<tr>
					<td>没有在线留言</td>
				</tr>					
				</c:if>	
		  </table>
		</dd>
	</dl>
	
	<!-- add by shaohua_jiang on 2011-05-05 for business message -->
	<c:if test="${fn:length(integrationMessages) gt 0}">
	
	<dl>	 	 	
		<dt>
		 
			<table style="width:100%;height:21px" border="0" cellpadding="0" cellspacing="0">
				<tr style="background: '';background-color: red;">
					<td width="3"><img src="client/images/menuLeft.gif" width="3" height="21" id="img_menuleft"></td>
					<td width="14" align="right" style="background:url(client/images/menubg.gif); background-repeat:repeat-x;"><img src="client/images/ico_select.gif" width="12" height="12" id="img_ico"></td>
					<td style="background:url(client/images/menubg.gif); background-repeat:repeat-x; color:#000">&nbsp;集成消息&nbsp;<font color="#777777">(${fn:length(integrationMessages)})</font></td>
					<td width="3"><img src="client/images/menuright.gif" width="3" height="21" id="img_menuright"></td>
				</tr>
			</table>		
	
			
		</dt>
		<dd>
			<table width="100%" class="tbl_left_ico">
				<c:if test="${approvalSize gt 0 }">
				
					<table style="width:100%;height:21px;cursor: pointer;" border="0" cellpadding="0" cellspacing="0" onclick="changeState(this,'approval')">
						<tr value="1">
							<td width="3"><img src="client/images/menuLeft.gif" width="3" height="21" id="img_menuleft"></td>
							<td width="14" align="right" style="background:url(client/images/menubg.gif); background-repeat:repeat-x;"><img src="client/images/ico_select.gif" width="12" height="12" id="img_ico"></td>
							<td style="background:url(client/images/menubg.gif); background-repeat:repeat-x; color:#000">&nbsp;审批消息&nbsp;<font color="#777777">(${approvalSize })</font></td>
							<td width="3"><img src="client/images/menuright.gif" width="3" height="21" id="img_menuright"></td>
						</tr>
					</table>
					
					
					<table width="100%" class="tbl_left_ico" id="approval">
						<c:forEach var="integrationMessage" items="${integrationMessages}">
							<c:if test="${integrationMessage.type eq 2 }">
								<tr>
									<th>&nbsp;</th>
									<!-- 
									<td><a href="${integrationMessage.urlPath }" <c:if test="${integrationMessage.sysType eq 1 }">target="_blank"</c:if><c:if test="${integrationMessage.sysType eq 1 }">target="_self"</c:if>>${integrationMessage.subject}</a></td>
									 -->
									 <td><ff:ssolink reqFrom="oa" nexturl="/modules/message/integrationMessage.do?type=2&method=show&id=${integrationMessage.id}" target="_blank">${integrationMessage.subject}</ff:ssolink>
									 <c:if test="${integrationMessage.isRead eq 0 }">
									 	<img src="<c:url value="client/images/new.gif"/>">
									 </c:if>
									 </td>
								</tr>									
							</c:if>
						</c:forEach>
					  </table>
				</c:if>
				<c:if test="${noticeSize gt 0 }">
					<table style="width:100%;height:21px;cursor: pointer;" border="0" cellpadding="0" cellspacing="0" onclick="changeState(this,'notice')">
						<tr>
							<td width="3"><img src="client/images/menuLeft.gif" width="3" height="21" id="img_menuleft"></td>
							<td width="14" align="right" style="background:url(client/images/menubg.gif); background-repeat:repeat-x;"><img src="client/images/ico_select.gif" width="12" height="12" id="img_ico"></td>
							<td style="background:url(client/images/menubg.gif); background-repeat:repeat-x; color:#000">&nbsp;通知消息&nbsp;<font color="#777777">(${noticeSize })</font></td>
							<td width="3"><img src="client/images/menuright.gif" width="3" height="21" id="img_menuright"></td>
						</tr>
					</table>
					<table width="100%" class="tbl_left_ico" id="notice">
						<c:forEach var="integrationMessage" items="${integrationMessages}">
							<c:if test="${integrationMessage.type eq 1 }">
								<tr>	
									<th>&nbsp;</th>
									<td><ff:ssolink reqFrom="oa" nexturl="/modules/message/integrationMessage.do?type=1&method=show&id=${integrationMessage.id}" target="_blank">${integrationMessage.subject}</ff:ssolink>
										<c:if test="${integrationMessage.isRead eq 0 }">
										 	<img src="<c:url value="client/images/new.gif"/>">
										 </c:if>
									</td>
								</tr>									
							</c:if>
						</c:forEach>
					  </table>
				</c:if>
			</table>
		</dd>
	</dl>
	
	</c:if>
	
	
	<!-- add by shaohua_jiang on 2011-05-05 for business message -->
	
	<c:set var="ver" value="${empty param.v?'1.0':param.v}"/>
	<!-- 使用参数设置在外边就不用总改程序了  -->
	<!-- R110324-072，雷德祥（dexiang_lei）,2011-05-12,检测oa助手是否升级为1.3版本 -->
	<!-- DMP:PT056260，RMP:R110930-0407,zxq,2011-10-20,检测oa助手是否升级为1.6版本,本次小助手增加了繁体安装包和繁体界面显示 -->
	<%-- DMP:PT057262，RMP:R111107-0520,hao_yun,2011-11-23,检测oa助手是否升级为1.7版本,本次小助手修正了退出后连接数不减的问题 --%>
	<%-- DMP:BT638341, hao_yun,2012-02-23,检测oa助手是否升级为1.9版本,本次修改了小助手安装包不能选择安装路径的问题 --%>
	<c:set var="newVer" value="${clientVersion}" />
	<!-- 演示产品，只做了简单不等判断  -->
	<c:if test="${ver lt newVer}">
	<dl>
		<dt>
		<table style="width:100%;height:21px; background-color:#edf7ff" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="3" height="21"><img src="client/images/menuLeft.gif" width="3" height="21" id="img_menuleft" style="display:none"></td>
					<td width="14" align="right"><img src="client/images/ico_noselect.gif" width="12" height="12" id="img_ico"></td>
					<td style="color:#000">&nbsp;助手升级&nbsp;</td>
					<td width="3"><img src="client/images/menuright.gif" width="3" height="21" id="img_menuright" style="display:none"></td>
				</tr>
		  </table>
	  </dt>
		<dd style="display:none">
			<table width="100%" class="tbl_left_ico">
				<tr>
					<td>助手已经升级到版本：${newVer}，您当前版本：${ver}，点<a href="components/oahelper/setup.exe" target="_blank"><font color="red">这里下载</font></a>升级程序，运行升级程序前先关闭办公助手！</td>
				</tr>			
		  </table>
		</dd>
	</dl>
	</c:if>	
</div>
<form name="checkInfoForm" method="post" action="<c:url value="/client.do"/>">
	<input type="hidden" name="method" value="checkInfo" />
	<input type="hidden" name="v" value="${ver}" />
	<input type="hidden" name="enc" value="UTF-8" />
	<input type="hidden" name="t" value="${param.t}" />
</form>
<script type="text/javascript">

	function changeState(curObj,id) {
		var obj = document.getElementById(id);
		if(obj.style.display == 'none') {
			obj.style.display = '';
			curObj.cells[1].children[0].src='client/images/ico_select.gif';
			
			for(var i=0; i < 4; i++) {
				curObj.cells[i].style.background='url(client/images/menubg.gif)';
				curObj.cells[i].style.backgroundRepeat="repeat-x";
			}

		} else {
			obj.style.display = 'none';
			curObj.cells[1].children[0].src='client/images/ico_noselect.gif';
			curObj.cells[0].children[0].style.display='none';
			curObj.cells[3].children[0].style.display='none';
			
			
			for(var i=0; i < 4; i++) {
				curObj.cells[i].style.background='';
				curObj.cells[i].style.backgroundColor="#edf7ff";
			}
		}
	}
	
</script>

<script type="text/javascript">
	var left = document.getElementById('left');
	var right = document.getElementById('right');
	var dls = left.getElementsByTagName('dl');
	for ( var i = 0; i < dls.length; i++) {
		var dt = dls[i].getElementsByTagName('dt')[0];		
		dt.dd = dls[i].getElementsByTagName('dd')[0];
		dt.onclick = function() {			
			this.dd.style.display == 'none'?this.dd.style.display = '':this.dd.style.display = 'none';
			if(this.dd.style.display == 'none')
			{
				this.children[0].cells[0].children[0].style.display='none';
				with(this.children[0].cells[1].children[0])
				{
				src='client/images/ico_noselect.gif';
				}
				this.children[0].cells[1].style.background='';
				this.children[0].cells[2].style.background='';
				this.children[0].cells[3].children[0].style.display='none';
				this.children[0].cells[0].style.backgroundColor='#edf7ff';
				this.children[0].cells[1].style.backgroundColor='#edf7ff';
				this.children[0].cells[2].style.backgroundColor='#edf7ff';
				this.children[0].cells[3].style.backgroundColor='#edf7ff';
			 }
			else
			{
				this.children[0].cells[0].children[0].style.display='';
				with(this.children[0].cells[1])
				{
				 style.background='url(client/images/menubg.gif)';
				 style.backgroundRepeat="repeat-x";
				 }
				 with(this.children[0].cells[1].children[0])
				{
				src='client/images/ico_select.gif';
				}
				with(this.children[0].cells[2])
				{
				 style.background='url(client/images/menubg.gif)';
				 style.backgroundRepeat="repeat-x";
				 style.color="#000";
				 }

				this.children[0].cells[3].children[0].style.display='';			
				
			 }
		}
	}
	
	//设置left的高度，滚动只在div范围内
	var clientHeight = document.body.clientHeight;
	left.style.height = clientHeight - 51;
	window.onresize = function() {
		clientHeight = document.body.clientHeight; 
		left.style.height = clientHeight - 51;
	}
	//add by liuzhengwei 2010-10-09  增加最新消息已阅功能 
	function readMessage(messageId)
	{
		var url='<c:url value="/client.do?method=singleRead"/>';
		new Ajax.Request(url, {method: 'post',postBody:"id="+messageId, onSuccess:function(t){
		//window.location.reload();
			document.checkInfoForm.submit();
		}});
	}
</script>
</body>
</html>
